#coding: utf-8
#Created: 16.02.12 22:28

import urllib.request
import http.cookiejar


data = {}

data['act'] = 'login'
data['q'] = '1'
data['al_frame'] = '1'
data['expire'] = ''
data['captcha_sid'] = ''
data['captcha_key'] = ''
data['from_host'] = 'vk.com'
data['from_protocol'] = 'http'
data['ip_h'] = '2f229e2785df5a11ac'
data['email'] = 'mail'
data['pass'] = 'pass'

dataToReq = urllib.parse.urlencode(data).encode('utf-8')

cookiejr = http.cookiejar.CookieJar()
opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cookiejr))

opener.open('https://login.vk.com/?act=login', dataToReq)
response = opener.open('http://vk.com/page')

debugFile = open('Files\\page.txt', 'w')
print (response.read().decode('windows-1251'), file= debugFile)
debugFile.close()


